import Vue from 'vue'
import App from './App2.vue'
import obj from './utils/filters'
import directives from './utils/directives'
import router from './router/index'
Object.keys(obj).forEach(key => {
  Vue.filter(key, obj[key])
})
Object.keys(directives).forEach(key => {
  Vue.directive(key, directives[key])
})

// Vue.directive('hello', function () {
//   console.log(arguments)
// })
// Vue.filter('qqq', function (val, ...arr) {
//   console.log(val, arr)
//   // this 不是组件实例  不用想着使用this
//   return 'qqq'
// })
// Vue.filter('money', function (val) {
//   return (val / 100).toFixed(2)
// })

// <a href="https://baidu.com" class="box">百度<b>哈哈</b></a>
// 用普通的JS对象 去模拟真实ＤＯＭ结构
/* 
  {
    tagName:'a',
    attrs:{},
    children:[
      {
        textNode:'',
        
      },
      {
        tagName:"b"
      }
    ]
  }

*/
Vue.component('www', {
  render(createElement) {
    // createElement(创造的标签的名字，{标签的行内属性},[多个子元素])
    return createElement('a', {
      class: "box", attrs: {
        href: 'https://baidu.com'
      }
    }, ["百度", createElement('b', '哈哈')])
  }
})
let app = new Vue({
  router,
  render(h) {
    return h(App)
  }
})

app.$mount('#myapp')
